﻿
using DH.Core;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace DH.Data.ORM.EF
{

    /// <summary>
    /// 仓储基类 EFCoreBaseRepository<TEntity>
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public class EFCoreBaseRepository<TEntity> : EFCoreQueryableRepository<TEntity, string> where TEntity : BaseEntity
    {
        public EFCoreBaseRepository(DbContext context) : base(context)
        {
        }
        public override IQueryable<TEntity> QueryById(string id)
        {
            return Query().Where(e => e.Id == id);
        }
    }
    /// <summary>
    /// 仓储基类 EFCoreBaseRepository<TEntity, TKey>
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    /// <typeparam name="TKey"></typeparam>
    public class EFCoreBaseRepository<TEntity, TKey> : EFCoreQueryableRepository<TEntity, TKey> where TEntity : BaseEntity<TKey>
    {
        public EFCoreBaseRepository(DbContext context) : base(context)
        {
        }
        public override IQueryable<TEntity> QueryById(TKey id)
        {
            return Query().Where(e => e.Id.Equals(id));
        }


    }

}
